package com.le.tester.onjava8.l1_8;

import java.util.EnumSet;

import static com.le.tester.onjava8.l1_8.AlarmPoints.*;

/**
 * createTime：2022/10/25 14:24
 * description：EnumSets
 */
public class EnumSets {
    public static void main(String[] args) {


        EnumSet<AlarmPoints> points = EnumSet.noneOf(AlarmPoints.class);

        points.add(BATHROOM);

        System.out.println(points);

        points.addAll(EnumSet.of(STAIR1, STAIR2, KITCHEN));

        System.out.println(points);

        //不允许有相同的实例，那么相同的实例会被覆盖掉
        points = EnumSet.allOf(AlarmPoints.class);

        System.out.println(points);

        points.removeAll(EnumSet.range(OFFICE1, OFFICE4));

        System.out.println(points);

        points = EnumSet.complementOf(points);

        System.out.println(points);
    }
}
